package com.tencent.service;

import com.tencent.common.Configure;
import com.tencent.common.Signature;
import com.tencent.protocol.pay_unifiedorder.UnifiedorderRequest;

public class UnifiedorderService  extends BaseService{

	public UnifiedorderService()
			throws ClassNotFoundException, IllegalAccessException, InstantiationException {
		super(Configure.UNIFIEDORDER_API);
	}

	/**
	 * 请求统一下单服务
	 * @param refundReqData 这个数据对象里面包含了API要求提交的各种数据字段
	 * @return API返回的XML数据
	 * @throws Exception
	 */
	public String request(UnifiedorderRequest unifiedorderReqData) throws Exception {
		unifiedorderReqData.setSign(null);
		String sign = Signature.getSign(unifiedorderReqData.toMap());
		unifiedorderReqData.setSign(sign);
		//--------------------------------------------------------------------
		//发送HTTPS的Post请求到API地址
		//--------------------------------------------------------------------
		String responseString = sendPost(unifiedorderReqData);

		return responseString;
	}

}
